package com.caregiver.watch.business.user.controller;

import com.caregiver.watch.business.user.model.dto.SendSmsCodeParam;
import com.caregiver.watch.business.user.model.dto.VerifySmsCodeParam;
import com.caregiver.watch.business.user.service.SmsService;
import com.caregiver.watch.common.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 短信
 * @Author 疆戟
 * @Date 2025/8/17 10:23
 * @Version 1.0
 */
@Tag(name  = "SmsController", description = "短信")
@RestController
@RequestMapping("sms")
public class SmsController {

    @Autowired
    private SmsService smsService;

    @Operation(summary = "发送短信验证码", description = "向指定手机号发送短信验证码")
    @PostMapping("sendSmsCode")
    public R<Boolean> sendSmsCode(@RequestBody SendSmsCodeParam param) {
        return R.ok(smsService.sendSmsCode(param));
    }


    @Operation(summary = "验证短信验证码", description = "验证短信验证码")
    @PostMapping("verifySmsCode")
    public R<Boolean> verifySmsCode(@RequestBody VerifySmsCodeParam param) {
        return R.ok(smsService.verifySmsCode(param));
    }

}
